package cn.tedu.demo05wangaoshong.san;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/*@Component就是组件扫描保存到Spring容器的关键注解之一
* Component是组建的意思，当前类被扫描时，会自动实例化一个对象
*
* */

@Component

//@Scope("prototype")
public class GuanYu {
    private String name="关羽";

    @Autowired
    private DragonBlade dragonBlade;

    public DragonBlade getDragonBlade() {
        return dragonBlade;
    }

    public void setDragonBlade(DragonBlade dragonBlade) {
        this.dragonBlade = dragonBlade;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void fight() {
        System.out.println(name+"使用"+dragonBlade+"在战斗!");
    }

}
